"""
自定义异常
"""


class Error(Exception):
    """Base class for exceptions in this module."""
    pass


class PredcitError(Exception):
    """
    预测失败，结果为None
    """
    def __init__(self, message):
        """
        :param message: 错误信息
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class PredictParamsFormatError(Exception):
    """
    预测参数错误Exception
    """
    def __init__(self, message):
        """
        :param message: 错误信息
        """
        self.message = message

    def __str__(self):
        return repr(self.message)
    

class PredictParamsNotFoundDiscreteError(Exception):
    """
    预测参数离散值没有找到错误
    """
    def __init__(self, message):
        """
        :param message: 错误信息
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class TaskParamsFormatError(Exception):
    """
    任务参数错误
    """
    def __init__(self, message):
        """
        :param message: 错误信息
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class MenUsedUpToMaxError(Exception):
    """
    内存达到阈值
    """
    def __init__(self, message):
        """
        :param message: 错误信息
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class TaskHasExistError(Exception):
    """
    任务已经存在
    """
    def __init__(self, task_id):
        """
        :param self:
        :param task_id: 任务Id
        :return:
        """
        self.message = "任务Id: " + str(task_id) + " 已经存在"

    def __str__(self):
        return repr(self.message)


class TaskInitError(Exception):
    """
    预测任务初始化失败
    """
    def __init__(self, message):
        """
        :param message:
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class TaskNotInitError(Exception):
    """
       预测任务没有初始化
       """

    def __init__(self, message):
        """
        :param message:
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class TaskNotFoundError(Exception):
    """
    预测任务未找到
    """
    def __init__(self, message):
        """
        :param message:
        """
        self.message = message

    def __str__(self):
        return repr(self.message)


class DataBaseError(Exception):
    """
    数据库错误
    """
    def __index__(self, message):
        """
        :param message:
        :return:
        """
        self.message = message

    def __str__(self):
        return repr(self.message)